<?php

namespace app\admin\controller;

use think\Controller;
use think\Request;
use think\Db;

class Powerlist extends Controller
{
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function index()
    {
       
        $data = Db::table('rbac_user')->alias(['rbac_user'=>'ru','rbac_role'=>'rr'])->join('rbac_role','rr.user_id= ru.id')->select();


       // var_dump($data);die;

        return view('admin/powerlist',['title'=>'redcat','data'=>$data]);
    }


    //加载编辑页面
    public function ccc()
    {   
        // var_dump($_GET);die;
        //先查询到数据,然后放到视图里
        
        $data = Db::table('rbac_user')->where(['rr.id' => $_GET['id']])->alias(['rbac_user'=>'ru','rbac_role'=>'rr'])->join('rbac_role','rr.user_id= ru.id')->select();


        // var_dump($data);die;

        return view('admin/poweredit',['title'=>'redcat','data'=>$data]);
    }

    //执行编辑功能
    // public function update()
    // {

    // }


}
